package com.action;

import com.controller.GetResultList;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lirance on 16/5/18.
 */
public class getResultsByDataNum extends BaseAction {
    double lmd;
    int clustNum;
    int k;

    List<Double> mae;
    List<Double> rmse;

    public double getLmd() {
        return lmd;
    }

    public void setLmd(double lmd) {
        this.lmd = lmd;
    }

    public int getClustNum() {
        return clustNum;
    }

    public void setClustNum(int clustNum) {
        this.clustNum = clustNum;
    }

    public int getK() {
        return k;
    }

    public void setK(int k) {
        this.k = k;
    }

    public List<Double> getMae() {
        return mae;
    }

    public void setMae(List<Double> mae) {
        this.mae = mae;
    }

    public List<Double> getRmse() {
        return rmse;
    }

    public void setRmse(List<Double> rmse) {
        this.rmse = rmse;
    }

    @Override
    public String execute() throws Exception {
        this.setMae(new ArrayList<>());
        this.setRmse(new ArrayList<>());
        if (lmd != 0) {
            for (int i = 10; i <= 50; i += 10) {
                //dataNum=i;
               /* List<Double> l = new GetMaeRmse().GetMaeRmse(lmd, k, clustNum,30);*/
                List<Double> l=new GetResultList().GetResult(k, i, lmd, clustNum);
                mae.add(l.get(0));
                rmse.add(l.get(1));
            }
        }
        return SUCCESS;
    }
}
